package com.gimi.cloud.jimi.common.enums;

/**
 * 返回代码状态
 */
public enum ResponseCodeEnum {
    INVALID("-1", "无效状态"),
    SUCCESSED("0000","操作成功"),
    FAILURE("-9999","操作失败"),
    ERR_USER_INVALID("0201","用户不存在"),
    VALIDE_CODE_SEND_SUCCESS("0000", "验证码已发送"),
    ERR_SENT_MSG_FAIL("0019", "短信接口功能性问题"),
    //针对user响应信息mso
    ERR_PHONE_USED("0205","您所输入的手机号码已经注册，请直接登录"),
    ERR_PHONE_INVALID("0204", "手机号格式错误"),
    ACCESS_BARRED("0403", "验证码已发送，60秒后重新获取"),
    ACCESS_FAIL_ERR("0402", "验证码发送失败，请稍后重试"),
    ACCESS_TIME_OUT("0404", "验证码已超时"),
    ACCESS_ERROR("0405", "验证码错误"),
    ACCESS_GET_ERROR("0406", "请先获取验证码"),
    ERR_USER_LOCKED_CAUSE_PWD("0214","用户被锁定，多次输入登录密码错误"),
    ERR_PWD_NOT_EXIST("0215","密码不存在，请登录后设置密码"),
    ERR_PWD_NOT_CORRECT("0217","密码错误"),
    OPERATOR_NAME_NOT_EMPTY("2018", "用户名不能为空！"),
    ERR_PWD_REPEAT("0219","密码不一致"),
    ERR_USERNAME_USED("0220","用户名被占用"),
    ERR_USERNAME_INVALID("0221","用户名格式不正确"),
    ERR_PWD_INVALID ("0222","密码格式不正确"),
    LOGIN_REPEAT_ERROR("0227","您的账号在其他机器登录"),
    ERR_MASTER_IS_LOCKED ("0223","账号已被锁定，请联系管理员解锁！"),
    ERR_MASTER_STATE ("0224","账号已被禁用，请联系管理员重新启用！"),
    ERR_MASTER_IS_DELETED ("0225","账号状态异常，请联系管理员查看状态！"),
    ERR_ROLE_LIST_NULL ("0226","账号角色为空，请联系管理员查看状态！"),
    ERR_USERPASSWORD_INIT("0227","密码已存在"),
    EMPTY_RESULTSET("0228","身份证有效期为空"),
    ID_CARD_EXPIRED("0229","该身份证已到期"),
    PARAMS_FORMAT_ERROR("0230","身份证有效期格式错误"),
    ERR_REALNAME_NOT_AUTH("0231","该身份证已实名"),
    ERR_CARDPIC_NOT_EXIST("0232","身份证正反面照片未上传"),
    ERR_BANKNO_NOT_AUTH("0233","该银行卡已被认证"),
    ERR_CARDID_NOT_AUTH("0234","请先实名认证后再进行银行卡校验"),
    BANK_ERROR("0235","暂不支持该银行！"),
    MEMORY_CARD("0236","银行卡仅支持储蓄卡！"),
    ERROR_MEMORY_CARD("0237","银行行别代码不存在！"),
    ERROR_REQUEST("0238","非法请求！"),
    ERROR_REQUEST_TOKEN_GET("0239","银行卡获取sessionToken异常！"),

    PARAMETER_ERROR("1000", "参数错误，或者缺少必填字段，请确认后重试！"),
    PARAMETER_EXCEPTION("1001", "参数异常"),//在feign中使用，意思和参数错误一样
    UNKNOWN_ERROR("2000","未知错误"),
    NETWORK_ERROR("3001", "网络错误"),
    SERVICE_NAME_NOT_FOUND("3000", "服务名称错误或尚未提供指定服务"),
    GET_INTERFACEPLATFORM_API_ERROR("3500", "获取访问路径异常"),
    GET_INTERFACEPLATFORM_TOKEN_HEAD_ERROR("3501", "获取携带TOKEN的请求头异常"),
    SKU_NOT_CHANGE("3502", "此商品状态不支持修改!"),
    EXCEED_THE_LOAD("4000", "系统繁忙"),
    NO_DATA("0010", "没有查到数据"),

    ERR_TO_GET_TOKEN("2003","授权失败！"),
    ERR_ACCOUNT_TO_GET_TOKEN("2004","账户信息错误，请联系服务方校验账户信息"),
    ERR_PASSWORD_TO_GET_TOKEN("2005","账号或密码错误"),
    NO_ACCOUNT_TO_GET_TOKEN("2006","账户信息异常，请先开通账户"),
    ERR_ACCOUNT_HAVE_NOT_ID("2007","账户信息异常!"),
    IP_NOT_IN_WHITE_LIST("2008","ip不在白名单中"),
    SIGNATURE_ERROR("2009", "令牌错误"),
    SIGNATURE_TIMEOUT("2010", "令牌过期"),

    MANAGE_JWT_TOKEN_SECRET_ERR("3001", "获取token_secret失败"),
    MANAGE_GET_MENU_LIST_ERR("3002", "获取用户菜单失败"),
    MANAGE_AUTH_DO_AUTH_ERR("3002", "授权失败"),
    
	PROD_SKU_PRICE_ERR("4001", "商品Sku价格异常"),
	PROD_SKU_IMG_ERR("4002", "商品Sku图片异常"),
	PROD_SKU_PARAMS_ERR("4003", "商品Sku参数异常"),
	PROD_IMG_ERR("4004", "商品图片异常"),
	PROD_ID_ERR("4005", "商品ID获取失败"),
	MANAGE_MASTER_NAME_EXIST("3003","用户名已经存在"),
	PROD_PARAMS_ERR("4006", "商品品类异常"),
	PROD_STATUS_ERR("4007", "上架状态商品不能修改"),
    PROD_DELETE_ERR("4008", "删除商品失败"),
    PROD_OFF_SHELF_ERR("4009", "商品下架失败"),
    PROD_UP_SHELF_ERR("4010", "商品上架失败"),
    PROD_CATEGORY_IS_NULL("4011", "商户经营范围为空"),

    AD_IS_PUBLISHED_CANNOT_DEL("7575","该广告已发布不能删除，请下架后重试！"),
    PRICE_IS_NOT_EMPTY("7576","商品广告价格和商品原价不能为空！"),
    MAJORAD_COLUMN_IS_NOT_EMPTY("7577","主页广告为商品，栏目名称不能为空，请选择一个栏目！"),
    MAJORAD_PRODUCT_IS_NOT_EMPTY("7578","主页广告为商品，商品名称不能为空，请选择一个商品！"),
    AD_PRODUCT_IS_NOT_EMPTY("7579","广告为商品，商品名称不能为空，请选择一个商品！"),
    TARGET_URL_IS_EMPTY("7580","需要添加转跳链接！"),
    UNDER_AD_FAIL("7582","下架广告失败，请确认后重试！"),
    PUBLISH_AD_FAIL("7581","发布广告失败，请确认后重试！"),
    MAJORAD_IS_NOT_EXIT_OR_LOAODING_OR_UNDER("7583","选择的主页广告不存在或者不处于待发布和撤下状态，请确认后重试！"),
    MAJORAD_IS_NOT_EXIT_OR_PUBLISH("7584","选择的主页广告不存在或者不处于发布状态，请确认后重试！"),
    MAJORAD_IS_NOT_EXIT("7585","选择的首页广告不存在，请确认后重试！"),
    MAJORAD_IS_EXIT("7586","该首页广告名称已经存在！"),
    AD_IS_NOT_EXIT_OR_LOAODING_OR_UNDER("7589","选择的广告不存在或者不处于待发布和撤下状态，请确认后重试！"),
    AD_IS_NOT_EXIT_OR_PUBLISH("7590","选择的广告不存在或者不处于发布状态，请确认后重试！"),
    AD_IS_EXIT("7587","该广告名称已经存在！"),
    AD_IS_NOT_EXIT("7591","选择的广告不存在，请确认后重试！"),
    DELETE_AD_FAIL("7592","删除广告失败，请确认后重试！"),
    UPDATE_AD_FAIL("7593","编辑广告失败，请确认后重试！"),
    ADD_AD_FAIL("7594","添加广告失败，请确认后重试！"),
    COLUMN_IS_EXIT("7588","该栏目名称已经存在！"),
    COLUMN_IS_NOT_EXIT("7595","选择的栏目不存在，请确认后重试！"),
    DELETE_COLUMN_FAIL("7596","启动/禁用栏目失败，请确认后重试！"),
    UPDATE_COLUMN_FAIL("7597","编辑栏目失败，请确认后重试！"),
    ADD_COLUMN_FAIL("7598","添加栏目失败，请确认后重试！"),
    ADD_COLUMNPROD_FAIL_COLUMN_IS_NOT_FOUND("7400","添加栏目管理下的商品失败，栏目不存在，请确认后重试！"),
    ADD_COLUMNPROD_FAIL_COLUMNPROD_IS_EXIT("7401","添加栏目管理下的商品失败，商品在该栏目下已存在，请确认后重试！"),
    ADD_COLUMNPROD_FAIL_PRODUCT_IS_EXIT("7402","添加栏目管理下的商品失败，商品不存在，请确认后重试！"),
    ADD_COLUMNPROD_FAIL("7403","添加栏目管理下的商品失败，请确认后重试！"),
    EDIT_COLUMNPROD_FAIL("7404","编辑栏目管理下的商品失败，请确认后重试！"),
    DEL_COLUMNPROD_FAIL("7405","删除栏目管理下的商品失败，请确认后重试！"),
    COLUMN_SORT_IS_OUT_OF_LENGTH("7406","栏目排序不能超过9位！"),
    COLUMN_DO_NOT_HAVE_AD_OR_PROD("7407","启用失败，该栏目下没有广告或商品，请在该栏目商品管理添加后重试！"),

    PRODCATID_DELETE_FAIL("7599","禁用/启用失败，请确认后重试！"),
    PRODCATID_IS_NOT_RIGHT("7600","添加失败，商品品类不属于三级品类！"),
    PRODCATID_IS_NOT_EXIT("7601","添加失败，商品品类不存在！"),
    PRODCATNAME_IS_EXIT("7609","添加失败，商品品类名称已经存在！"),
    ADD_PRODCATEGORY_IS_NOT_SURE("7612","添加失败，该品类分类级别和父分类的填写不符合要求！"),
    PRODCATNAME_UPDATE_IS_EXIT("7611","修改失败，商品品类名称已经存在！"),
    PRODCAT_CANNOT_CHANGE("7610","修改失败，商品品类分类级别和父类编号不能改变！"),
    PRODCATMODEL_IS_NOT_EXIT("7602","删除/启用失败，该商品品类模板不存在！"),
    UPDATE_PRODCATID_IS_NOT_EXIT("7607","修改失败，商品品类不存在！"),
    PRODCATMODEL_IS_EXIT("7608","添加失败，该商品品类模板已经存在！"),
    PRODCATID_REAL_DELETE_FAIL("7509","删除失败，请确认后重试！"),
    PRODCATMODEL_VALUE_IS_NOT_EXIT("7510","该商品品类模板属性值不存在，请确认后重试！"),
    PRODCATMODEL_VALUE_ADD_FAIL("7511","品类模板属性值添加失败，请确认后重试！"),
    PRODCATMODEL_VALUE_EDIT_FAIL("7512","品类模板属性值编辑失败，请确认后重试！"),
    PRODCATMODEL_VALUE_ID_FAIL("7513","添加失败，该品类模板属性值已经存在！"),
    PRODCATMODEL_IS_EXIT_WHEN_EDIT("7514","编辑失败，该商品品类模板已经存在！"),
    PRODCATMODEL_VALUE_IS_EXIT_WHEN_EDIT("7515","编辑失败，该商品品类模板值已经存在！"),


    PRODCATEGORY_IS_NOT_EXIT("7603","删除失败，该商品品类不存在！"),
    PRODBRAND_IS_NOT_EXIT("7604","删除/启用失败，该商品品牌不存在！"),
    UPDATE_PRODCATID_IS_NOT_RIGHT("7605","修改失败，商品品类不属于三级品类！"),
    ADD_PRODCATID_IS_NOT_RIGHT("7606","添加失败，商品品类不属于三级品类！"),
    ADD_PRODBRAND_IS_EXIST("7607","添加失败，该品牌名称已经存在！"),

    TD_DATA_ERROR_TIMES_IS_OUT_OF_TIMES("7100","该用户的获取同盾的容错次数已经超过最大值"),
    ZM_DATA_ERROR_TIMES_IS_OUT_OF_TIMES("7700","该用户的获取芝麻信用的容错次数已经超过最大值"),
    SHEBAO_DATA_ERROR_TIMES_IS_OUT_OF_TIMES("7703","该用户的蜂巢社保的获取容错次数已经超过最大值"),
    GONGJIJING_DATA_ERROR_TIMES_IS_OUT_OF_TIMES("7705","该用户的蜂巢公积金的获取容错次数已经超过最大值"),
    CREDITCARDEMAIL_DATA_ERROR_TIMES_IS_OUT_OF_TIMES("7705","该用户的蜂巢信用卡邮箱账单的获取容错次数已经超过最大值"),
    CREDITCARDWATER_DATA_ERROR_TIMES_IS_OUT_OF_TIMES("7718","该用户的蜂巢信用卡流水的获取容错次数已经超过最大值"),
    SHEBAO_IS_NOT_FOUND("7704","该用户社保登录未成功,社保记录不存在！"),
    GOJIJING_IS_NOT_FOUND("7706","该用户公积金登录未成功,公积金记录不存在！"),
    CREDITCARDEMAIL_IS_NOT_FOUND("7715","该用户信用卡邮箱登录未成功,信用卡邮箱记录不存在！"),
    INTERFACE_ERROR("7701","解析接口出错"),
    INTERFACE_MESSAGE("7702",""),
    LOGIN_EXCEPTION("7707","蜂巢信用卡登录异常"),
    SERVICE_ERROR("7708","服务异常"),
    NEED_IMAGECODE_VALIDATION("7716","需要校验图片验证码"),
    NEED_PHONECODE_VALIDATION("7717","需要校验短信验证码"),
    NEED_VALIDATION("7709","需要校验图片验证码和短信验证码"),
    FENGCHAO_EMAIL_LOGIN_EXCEPTION("7710","蜂巢信用卡邮箱登录异常"),
    FENGCHAO_EMAIL_STATUS_EXCEPTION("7711","蜂巢邮箱状态查询异常"),
    INDEPENDENTPASSWORD_EMAIL_EXCEPTION("7712","蜂巢邮箱独立密码提交接口异常"),
    VALIDCODE_FENGCHAO_EMAIL_EXCEPTION("7713","蜂巢邮箱登验证码提交接口异常"),
    OBTAINBILLS_FENGCHAO_EMAIL_STATUS_EXCEPTION("7714","蜂巢获取信用卡邮箱账单解析结果异常"),
    VALIDCODE_DEBITCARD_EXCEPTION("7721","蜂巢工资卡登验证码提交接口异常"),
    REFRESH_DEBITCARD_EXCEPTION("7722","蜂巢工资卡刷新登验证码接口异常"),
    DEBIT_IS_NOT_FOUND("7723","该用户工资卡登录未成功,工资卡记录不存在！"),
    DEBIT_DATA_ERROR_TIMES_IS_OUT_OF_TIMES("7724","该用户的蜂巢工资卡的获取容错次数已经超过最大值"),
    DEBIT_LOGIN_EXCEPTION("7727","蜂巢工资卡登录异常"),
    DEBIT_LOGIN_ERROR("7725","系统错误"),
    DEBIT_LOGIN_SESSIONTOKEN_ERR("7726","验证码过期，请重新获取验证码"),
    /**
     * 菜单删除操作失败码
     */
    MENU_DELETE_ERR("4101","删除菜单失败"),

    /**
     * 商铺操作
     */
    STORE_ADD_ERR("4201","添加商铺失败"),
    STORE_UPDATE_ERR("4202","更新商铺失败"),
    STORE_DELETE_ERR("4203","删除商铺失败"),
    STORE_MERCHANT_ADD_ERR("4204","添加商铺经营范围失败"),
    STORE_MERCHANT_UPDATE_ERR("4205","更新商铺经营范围失败"),
    STORE_MERCHANT_DELETE_ERR("4206","删除商铺经营范围失败"),

    /**
     * app返回码
     */
    APP_COLUMN_ID_NULL("8001","没有展示栏目"),
    APP_AD_ID_NULL("8002","没有可展示的广告"),
    APP_MAJOR_ADD_NULL("8003","没有可用的banner"),

    /**
     * 聚信力返回码
     */
    JXL_SEND_ERROR("9001", "短信验证码发送失败");

    /**
     * 状态值
     */
    private String status;

    /**
     * 状态描述
     */
    private String desc;

    private ResponseCodeEnum(String status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public String getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据状态值获取枚举值
     *
     * @param status
     * @return
     */
    public static ResponseCodeEnum getStatus(String status) {
        for (ResponseCodeEnum e : ResponseCodeEnum.values()) {
            if (e.getStatus() == status) {
                return e;
            }
        }

        return INVALID;
    }

    /**
     * 根据状态值获取枚举值
     *
     * @param status
     * @return
     */
    public static ResponseCodeEnum getStatus(Integer status) {
        return status==null ? INVALID : getStatus(status.intValue());
    }

}